feat(NODE-7320): Update $ne operator to include null type#4801
feat(NODE-7320): Update $ne operator to include null type#4801christophehurpeau wants to merge 1 commit intomongodb:mainfrom
Conversation
Allow $ne operator to accept null values. null value is useful when we want to have a similar behavior as exists, but including `null` values even if the Value is not declared as nullable.
|
Hi @christophehurpeau, thank you for the contribution! We are going to discuss this change internally as there are some usability and necessity questions arose. Can you maybe share the exact use-case or small snippet to demonstrate usage scenario, this would be extremely helpful. |
|
Of course. Most of our models include an schema with non-nullable fields. Here a simple example: interface EndUser {
_id: Types.ObjectID;
fullname: string;
email?: string;
}With an index on const endUsers = await EndUserQueries.find({ email: { $ne: null } }) |
|
Hi @christophehurpeau, While I understand the convenience this would provide from the application side, we have to consider the driver’s role as a transparent interface to the database. There is a fundamental distinction between a field being Please let me know if this helps! |
From what I understood, |
Description
Summary of Changes
Allow $ne operator to accept null values.
null value is useful when we want to have a similar behavior as exists, but including
nullvalues even if the Value is not declared as nullable.Notes for Reviewers
What is the motivation for this change?
Release Highlight
Release notes highlight
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript